package com.yinNuo.collectWool.mobileApi.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yinNuo.collectWool.mobileApi.dao.UserDoTaskDao;
import com.yinNuo.collectWool.mobileApi.entity.UserDoTask;
import com.yinNuo.collectWool.mobileApi.service.UserDoTaskService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;



/**
 * 用户做任务详细表 所有数据都是从这里判断(UserDoTask)表服务实现类
 *
 * @author makejava
 * @since 2021-12-12 11:00:40
 */
@Service("userDoTaskService")
public class UserDoTaskServiceImpl extends ServiceImpl<UserDoTaskDao,UserDoTask> implements UserDoTaskService {
    @Resource
    private UserDoTaskDao userDoTaskDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public UserDoTask queryById(Integer id) {
        return this.userDoTaskDao.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param userDoTask 实例对象
     * @return 实例对象
     */
    @Override
    public UserDoTask insert(UserDoTask userDoTask) {
        this.userDoTaskDao.insert(userDoTask);
        return userDoTask;
    }

    /**
     * 修改数据
     *
     * @param userDoTask 实例对象
     * @return 实例对象
     */
    @Override
    public UserDoTask update(UserDoTask userDoTask) {
        this.userDoTaskDao.update(userDoTask);
        return this.queryById(userDoTask.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.userDoTaskDao.deleteById(id) > 0;
    }
}
